import React from 'react';
import Items from '../components/items';

class ShouldUpdatePage extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
          items: [1,2,3,4],
        };
    }

    updateItem = index => value => {
        let newItems = [...this.state.items];
        newItems[index] = value;
        this.setState({
            items: newItems,
        })
    };

    render() {
        return (
            <React.Fragment>
                <Items items={this.state.items} updateItem={this.updateItem}/>
            </React.Fragment>
        )
    }
}

export default ShouldUpdatePage;
